require 'pp'

#TODO: 1、重构status与terminal之间的关系，:status => {:terminal => {...}, :app, :app_id....}
#TODO: 2、通过mac查询terminal是否已存在，若不存在要先保存terminal相关信息 
module API::V3
  class Statuses < Grape::API
    resource :statuses do
      post do
        if params[:status]
          status = Status.new(params[:status])    
          status.remote_ip = request.env["REMOTE_ADDR"]  
          if status.save
            present result: true
          else
            not_found!
          end
        else
          forbidden!
        end
      end
    end
  end
end